package com.demo.xrom.ssh.service.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.demo.xrom.ssh.dao.PersonDao;
import com.demo.xrom.ssh.entity.Person;
import com.demo.xrom.ssh.service.PersonService;
import com.smart.common.util.Page;
import com.smart.common.util.PageRequest;

/**
 * 
 * 版权所有：xxxxxxx
 * @Description: TODO
 * @Title: PersonServiceImpl.java 
 * @ClassName: PersonServiceImpl 
 * @author tangyan 
 * @date 2019年2月12日 下午2:49:53 
 * @version V1.0
 */
@Service(value="personService")
public class PersonServiceImpl implements PersonService {

    @Autowired
    private PersonDao personDao;

    @Override
    @Transactional(propagation=Propagation.REQUIRED,rollbackFor=Throwable.class)
    public Person savePerson() {
        Person person = new Person();
        person.setUsername("XRog");
        person.setPhone("18381005946");
        person.setAddress("chenDu");
        person.setRemark("this is XRog");
        return personDao.saveEntity(person);
    }

	@Override
	public Page<Person> queryPersonPage(PageRequest pageRequest, Map<String, Object> conditions) {
		return personDao.queryPersonPage(pageRequest, conditions);
	}
}
